package t327.pojo.staffView;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class StaffPunchCardView {
  private Long Id;
  private Long staffId;
  private String staffName;
  private String staffSex;
  private String staffType;
    @DateTimeFormat(pattern = "HH:mm:ss")
    @JsonFormat(timezone = "GMT+8",pattern = "HH:mm:ss")
  private Date staffClockIn;
    @DateTimeFormat(pattern = "HH:mm:ss")
    @JsonFormat(timezone = "GMT+8",pattern = "HH:mm:ss")
  private Date staffClockOut;
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
  private Date staffYearToDate;
  private String staffPosition;
  private String staffDepartment;
  private String staffImg;
  private double workingHours;
  private Long staffNumberOfCases;

  public void setStaffType(String staffType) {
    if ("1".equals(staffType)){
      this.staffType="正式工";
    }else if ("2".equals(staffType)){
      this.staffType="实习工";
    }else {
      this.staffType="未知";
    }
  }
  public void setStaffSex(String staffSex) {
    if ("1".equals(staffSex)) {
      this.staffSex="男";
    } else if ("0".equals(staffSex)) {
      this.staffSex="女";
    } else {
      this.staffSex="未知";
    }
  }
  public void setStaffPosition(String staffPosition) {
    if("0".equals(staffPosition)){
      this.staffPosition="职员";
    }else if("1".equals(staffPosition)){
      this.staffPosition="组长";
    }else if("2".equals(staffPosition)){
      this.staffPosition="车间主任";
    }else if("3".equals(staffPosition)){
      this.staffPosition="厂长";
    }else {
      this.staffPosition="未知";
    }
  }

}
